<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>功能管理</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
</h:head>

<ui:param name="bean" value="#{functionManagerAction}" />
<h:body>
	<p:outputLabel value="功能管理:"/>
	<h:form id="fadd">
		<p:dataTable var="function" value="#{bean.function}">
			<p:column headerText="选择模块" style="text-align:center">
				<p:selectOneMenu value="#{function.modelId}" label="选择模块" >
					<f:selectItem itemLabel="选择" itemValue="0" />
					<f:selectItems value="#{bean.modelMap.entrySet()}" var="entry" itemLabel="#{entry.value.description}" itemValue="#{entry.key}" />
				</p:selectOneMenu>
			</p:column>
			<p:column headerText="功能标识" style="text-align:center">
				<p:inputText size="16" maxlength="16"   value="#{function.id}"/>
			</p:column>
			<p:column headerText="功能名称" style="text-align:center">
				<p:inputText size="16" maxlength="64"   value="#{function.name}"/>
			</p:column>	
			<p:column headerText="功能地址" style="text-align:center">
				<p:inputText size="16" maxlength="88"   value="#{function.src}"/>
			</p:column>
			<p:column headerText="功能排序" style="text-align:center">
				<p:inputText size="16" maxlength="16"   value="#{function.sort}"/>
			</p:column>		
			<p:column headerText="功能状态" style="text-align:center">
				<p:selectOneMenu value="#{bean.function.status}" label="功能状态" >
					<f:selectItem itemLabel="选择" itemValue="0" />
					<f:selectItems value="#{bean.statusMap.entrySet()}" var="entry" itemLabel="#{entry.value}" itemValue="#{entry.key}" />
				</p:selectOneMenu>	
			</p:column>
			<p:column headerText="操作" style="text-align:center" width="12%">
				<p:commandButton value="查询" action="#{bean.search}" update=":flist:dlist" ajax="true"></p:commandButton>
			</p:column>
		</p:dataTable>
	</h:form>
	<br />

	<!-- 展示查询结果数据 -->
	<p:outputLabel value="查询结果："></p:outputLabel>
	<br />
	<h:form id="flist">
		<p:messages id="messages" showDetail="true" life="3000"/>	
		<p:dataTable id="dlist" var="function" value="#{bean.functionList}"	resizableColumns="true" paginator="true" rows="10">
			<p:column headerText="功能标识" style="text-align:center" width="8%">
				<h:outputText value="#{function.id}" readonly="true"/>
			</p:column>				
			<p:column headerText="功能模块" style="text-align:center" width="9%">
				<h:outputText value="#{bean.getMName(function.modelId)}"/>
			</p:column>						
			<p:column headerText="功能名称" style="text-align:center" width="12%">
				<p:inputText size="10" maxlength="24"  value="#{function.name}"/>
			</p:column>
			<p:column headerText="功能地址" style="text-align:center" width="23%">
				<p:inputText size="24" maxlength="88"  value="#{function.src}"/>
			</p:column>
			<p:column headerText="功能排序" style="text-align:center" width="10%">
				<p:inputText size="6" maxlength="10"  value="#{function.sort}"/>
			</p:column>
			<p:column headerText="功能状态" style="text-align:center" width="10%">
				<p:selectOneMenu value="#{function.status}" label="功能状态">
					<f:selectItems value="#{bean.statusMap.entrySet()}" var="entry" itemLabel="#{entry.value}" itemValue="#{entry.key}" />
				</p:selectOneMenu>	
			</p:column>	
			<p:column headerText="操作" style="text-align:center" width="16%">
				<p:commandButton value="修改" action="#{bean.modify(function)}"		update="dlist" ajax="true"/>
				<p:commandButton value="删除" action="#{bean.delete(function.id)}"	update="dlist" ajax="true">
					<p:confirm header="确认框" message="确定删除功能?" icon="ui-icon-alert" position="top" />
				</p:commandButton>
				<center>
					<p:confirmDialog global="true" showEffect="fade"
						hideEffect="explode" style="text-align:center">
						<p:commandButton value="确定" type="button"
							styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
						<p:commandButton value="取消" type="button"
							styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
					</p:confirmDialog>
				</center>
			</p:column>			
		</p:dataTable>
	</h:form>
</h:body>
</html>